
#################################
# Predictive Validity: Contrasts
################################

# Exploratory Analysis ---------------------------------------------------------
# Contrast tables
contrActivEA<-emmeans(mActivEA, ~InterestedNum*pos_id_mean*neg_id_mean, at=list) # save contrasts
df_contrActivEA<-data.frame(contrast(contrActivEA, method = "pairwise")) # save all contrasts in a data frame
df_contrActivEA <- df_contrActivEA %>% # rename InterestedNum
  mutate(contrast = gsub("InterestedNum", "Int", contrast))%>%
  mutate(contrast=gsub("pos_id_mean", "PosId", contrast))%>%
  mutate(contrast=gsub("neg_id_mean", "NegId", contrast))

contrEffEA<-emmeans(mEffEA, ~InterestedNum*pos_id_mean*neg_id_mean, at=list) # save contrasts
df_contrEffEA<-data.frame(contrast(contrEffEA, method = "pairwise")) # save all contrasts in a data frame
df_contrEffEA <- df_contrEffEA %>% # rename InterestedNum
  mutate(contrast = gsub("InterestedNum", "Int", contrast))%>%
  mutate(contrast=gsub("pos_id_mean", "PosId", contrast))%>%
  mutate(contrast=gsub("neg_id_mean", "NegId", contrast))

contrNewsEA<-emmeans(mNewsEA, ~InterestedNum*pos_id_mean*neg_id_mean, at=list) # save contrasts
df_contrNewsEA<-as.data.frame(contrast(contrNewsEA, method = "pairwise")) # save all contrasts in a data frame
df_contrNewsEA<- df_contrNewsEA %>% # rename InterestedNum
  mutate(contrast = gsub("InterestedNum", "Int", contrast))%>%
  mutate(contrast=gsub("pos_id_mean", "PosId", contrast))%>%
  mutate(contrast=gsub("neg_id_mean", "NegId", contrast))

contrOpenEA<-emmeans(mOpenEA, ~InterestedNum*pos_id_mean*neg_id_mean, at=list) # save contrasts
df_contrOpenEA<-data.frame(contrast(contrOpenEA, method = "pairwise")) # save all contrasts in a data frame
df_contrOpenEA <- df_contrOpenEA %>% # rename InterestedNum
  mutate(contrast = gsub("InterestedNum", "Int", contrast))%>%
  mutate(contrast=gsub("pos_id_mean", "PosId", contrast))%>%
  mutate(contrast=gsub("neg_id_mean", "NegId", contrast))

contrConfEA<-emmeans(mConfEA, ~InterestedNum*pos_id_mean*neg_id_mean, at=list) # save contrasts
df_contrConfEA<-data.frame(contrast(contrConfEA, method = "pairwise")) # save all contrasts in a data frame
df_contrConfEA <- df_contrConfEA %>% # rename InterestedNum
  mutate(contrast = gsub("InterestedNum", "Int", contrast))%>%
  mutate(contrast=gsub("pos_id_mean", "PosId", contrast))%>%
  mutate(contrast=gsub("neg_id_mean", "NegId", contrast))

contrKnowEA<-emmeans(mKnowEA, ~InterestedNum*pos_id_mean*neg_id_mean, at=list) # save contrasts
df_contrKnowEA<-data.frame(contrast(contrKnowEA, method = "pairwise")) # save all contrasts in a data frame
df_contrKnowEA <- df_contrKnowEA %>% # rename InterestedNum
  mutate(contrast = gsub("InterestedNum", "Int", contrast))%>%
  mutate(contrast=gsub("pos_id_mean", "PosId", contrast))%>%
  mutate(contrast=gsub("neg_id_mean", "NegId", contrast))


# Tables
stargazer(df_contrActivEA,
          summary = F, type="latex", digits = 3, align = TRUE, rownames = FALSE, style = "apsr")
stargazer(df_contrEffEA,align = TRUE,rownames = FALSE, style = "apsr",
          summary = F, type="latex", digits = 3)
stargazer(df_contrNewsEA,align = TRUE,rownames = FALSE, style = "apsr",
          summary = F, type="latex", digits = 3)
stargazer(df_contrOpenEA,align = TRUE,rownames = FALSE, style = "apsr",
          summary = F, type="latex", digits = 3)
stargazer(df_contrConfEA,align = TRUE,rownames = FALSE, style = "apsr",
          summary = F, type="latex", digits = 3)
stargazer(df_contrKnowEA,align = TRUE,rownames = FALSE, style = "apsr",
          summary = F, type="latex", digits = 3)

# Confirmatory Analysis ---------------------------------------------------------
# Contrast tables
contrActivCA<-emmeans(mActivCA , ~InterestedNum*pos_id_mean*neg_id_mean, at=list) # save contrasts
df_contrActivCA <-data.frame(contrast(contrActivCA , method = "pairwise")) # save all contrasts in a data frame
df_contrActivCA  <- df_contrActivCA  %>% # rename InterestedNum
  mutate(contrast = gsub("InterestedNum", "Int", contrast))%>%
  mutate(contrast=gsub("pos_id_mean", "PosId", contrast))%>%
  mutate(contrast=gsub("neg_id_mean", "NegId", contrast))

contrEffCA <-emmeans(mEffCA , ~InterestedNum*pos_id_mean*neg_id_mean, at=list) # save contrasts
df_contrEffCA <-data.frame(contrast(contrEffCA , method = "pairwise")) # save all contrasts in a data frame
df_contrEffCA  <- df_contrEffCA  %>% # rename InterestedNum
  mutate(contrast = gsub("InterestedNum", "Int", contrast))%>%
  mutate(contrast=gsub("pos_id_mean", "PosId", contrast))%>%
  mutate(contrast=gsub("neg_id_mean", "NegId", contrast))

contrNewsCA <-emmeans(mNewsCA , ~InterestedNum*pos_id_mean*neg_id_mean, at=list) # save contrasts
df_contrNewsCA <-as.data.frame(contrast(contrNewsCA , method = "pairwise")) # save all contrasts in a data frame
df_contrNewsCA <- df_contrNewsCA  %>% # rename InterestedNum
  mutate(contrast = gsub("InterestedNum", "Int", contrast))%>%
  mutate(contrast=gsub("pos_id_mean", "PosId", contrast))%>%
  mutate(contrast=gsub("neg_id_mean", "NegId", contrast))

contrOpenCA <-emmeans(mOpenCA , ~InterestedNum*pos_id_mean*neg_id_mean, at=list) # save contrasts
df_contrOpenCA <-data.frame(contrast(contrOpenCA , method = "pairwise")) # save all contrasts in a data frame
df_contrOpenCA  <- df_contrOpenCA  %>% # rename InterestedNum
  mutate(contrast = gsub("InterestedNum", "Int", contrast))%>%
  mutate(contrast=gsub("pos_id_mean", "PosId", contrast))%>%
  mutate(contrast=gsub("neg_id_mean", "NegId", contrast))

contrConfCA <-emmeans(mConfCA , ~InterestedNum*pos_id_mean*neg_id_mean, at=list) # save contrasts
df_contrConfCA <-data.frame(contrast(contrConfCA , method = "pairwise")) # save all contrasts in a data frame
df_contrConfCA  <- df_contrConfCA  %>% # rename InterestedNum
  mutate(contrast = gsub("InterestedNum", "Int", contrast))%>%
  mutate(contrast=gsub("pos_id_mean", "PosId", contrast))%>%
  mutate(contrast=gsub("neg_id_mean", "NegId", contrast))

contrKnowCA <-emmeans(mKnowCA , ~InterestedNum*pos_id_mean*neg_id_mean, at=list) # save contrasts
df_contrKnowCA <-data.frame(contrast(contrKnowCA , method = "pairwise")) # save all contrasts in a data frame
df_contrKnowCA  <- df_contrKnowCA  %>% # rename InterestedNum
  mutate(contrast = gsub("InterestedNum", "Int", contrast))%>%
  mutate(contrast=gsub("pos_id_mean", "PosId", contrast))%>%
  mutate(contrast=gsub("neg_id_mean", "NegId", contrast))


# Tables
stargazer(df_contrActivCA ,
          summary = F, type="latex", digits = 3, align = TRUE, rownames = FALSE, style = "apsr")
stargazer(df_contrEffCA ,align = TRUE,rownames = FALSE, style = "apsr",
          summary = F, type="latex", digits = 3)
stargazer(df_contrNewsCA ,align = TRUE,rownames = FALSE, style = "apsr",
          summary = F, type="latex", digits = 3)
stargazer(df_contrOpenCA ,align = TRUE,rownames = FALSE, style = "apsr",
          summary = F, type="latex", digits = 3)
stargazer(df_contrConfCA ,align = TRUE,rownames = FALSE, style = "apsr",
          summary = F, type="latex", digits = 3)
stargazer(df_contrKnowCA ,align = TRUE,rownames = FALSE, style = "apsr",
          summary = F, type="latex", digits = 3)


# Meta-Analysis ----------------------------------------------------------------
# Contrast tables
contrActiv<-emmeans(Mactiv, ~InterestedNum*pos_id_mean*neg_id_mean, at=list) # save contrasts

df_contrActiv<-data.frame(contrast(contrActiv, method = "pairwise")) # save all contrasts in a data frame
df_contrActiv <- df_contrActiv %>% # rename InterestedNum
  mutate(contrast = gsub("InterestedNum", "Int", contrast))%>%
  mutate(contrast=gsub("pos_id_mean", "PosId", contrast))%>%
  mutate(contrast=gsub("neg_id_mean", "NegId", contrast))

contrEff<-emmeans(Meff, ~InterestedNum*pos_id_mean*neg_id_mean, at=list) # save contrasts
df_contrEff<-data.frame(contrast(contrEff, method = "pairwise")) # save all contrasts in a data frame
df_contrEff <- df_contrEff %>% # rename InterestedNum
  mutate(contrast = gsub("InterestedNum", "Int", contrast))%>%
  mutate(contrast=gsub("pos_id_mean", "PosId", contrast))%>%
  mutate(contrast=gsub("neg_id_mean", "NegId", contrast))

contrNews<-emmeans(Mnews, ~InterestedNum*pos_id_mean*neg_id_mean, at=list) # save contrasts
df_contrNews<-as.data.frame(contrast(contrNews, method = "pairwise")) # save all contrasts in a data frame
df_contrNews <- df_contrNews %>% # rename InterestedNum
  mutate(contrast = gsub("InterestedNum", "Int", contrast))%>%
  mutate(contrast=gsub("pos_id_mean", "PosId", contrast))%>%
  mutate(contrast=gsub("neg_id_mean", "NegId", contrast))

contrOpen<-emmeans(Mopen, ~InterestedNum*pos_id_mean*neg_id_mean, at=list) # save contrasts
df_contrOpen<-data.frame(contrast(contrOpen, method = "pairwise")) # save all contrasts in a data frame
df_contrOpen <- df_contrOpen %>% # rename InterestedNum
  mutate(contrast = gsub("InterestedNum", "Int", contrast))%>%
  mutate(contrast=gsub("pos_id_mean", "PosId", contrast))%>%
  mutate(contrast=gsub("neg_id_mean", "NegId", contrast))

contrConf<-emmeans(Mconf, ~InterestedNum*pos_id_mean*neg_id_mean, at=list) # save contrasts
df_contrConf<-data.frame(contrast(contrConf, method = "pairwise")) # save all contrasts in a data frame
df_contrConf <- df_contrConf %>% # rename InterestedNum
  mutate(contrast = gsub("InterestedNum", "Int", contrast))%>%
  mutate(contrast=gsub("pos_id_mean", "PosId", contrast))%>%
  mutate(contrast=gsub("neg_id_mean", "NegId", contrast))

contrKnow<-emmeans(Mknow, ~InterestedNum*pos_id_mean*neg_id_mean, at=list) # save contrasts
df_contrKnow<-data.frame(contrast(contrKnow, method = "pairwise")) # save all contrasts in a data frame
df_contrKnow <- df_contrKnow %>% # rename InterestedNum
  mutate(contrast = gsub("InterestedNum", "Int", contrast))%>%
  mutate(contrast=gsub("pos_id_mean", "PosId", contrast))%>%
  mutate(contrast=gsub("neg_id_mean", "NegId", contrast))


# Tables
stargazer(df_contrActiv,
          summary = F, type="latex", digits = 3, align = TRUE, rownames = FALSE, style = "apsr")
stargazer(df_contrEff,align = TRUE,rownames = FALSE, style = "apsr",
          summary = F, type="latex", digits = 3)
stargazer(df_contrNews,align = TRUE,rownames = FALSE, style = "apsr",
          summary = F, type="latex", digits = 3)
stargazer(df_contrOpen,align = TRUE,rownames = FALSE, style = "apsr",
          summary = F, type="latex", digits = 3)
stargazer(df_contrConf,align = TRUE,rownames = FALSE, style = "apsr",
          summary = F, type="latex", digits = 3)
stargazer(df_contrKnow,align = TRUE,rownames = FALSE, style = "apsr",
          summary = F, type="latex", digits = 3)
